﻿using System.Data;

namespace Codemonk.Common.Data
{
    public interface IDataParameterCreater//<R> where R : IDataParameter, new()
    {
        IDataParameter CreateParameter();
        IDataParameter CreateParameter(string parameterName, DbType? type = null);
        IDataParameter CreateParameter(string parameterName, object value, DbType? type = null);
        IDataParameter CreateParameter(string parameterName, object value, ParameterDirection direction, bool isNullable, string sourceColumn, DbType? type = null, DataRowVersion sourceVersion = DataRowVersion.Default);

        IDataParameter[] GetFillParameters(IDbCommand cmd);
        IDataParameter[] GetFillParameters(IDbDataAdapter adapter);
        IDataParameter[] GetFillParameters(IDbConnection connection, string cmdtext, params IDataParameter[] paras);
        IDataParameter[] GetFillParameters(IDbConnection connection, string cmdtext, DbParameterBuilder builder);
        IDataParameter[] GetFillParameters<T>(IDbConnection connection, string cmdtext, DbParameterBuilder<T> builder) where T : IDataParameter, new();
        IDataParameter[] GetFillParameters(string cmdtext, params IDataParameter[] paras);
        IDataParameter[] GetFillParameters(string cmdtext, DbParameterBuilder builder);
        IDataParameter[] GetFillParameters<T>(string cmdtext, DbParameterBuilder<T> builder) where T : IDataParameter, new();

        DbParameterBuilder CreateParameterBuilder(bool isCheckName = false);
        DbParameterBuilder CreateParameterBuilder(int capacity, bool isCheckName = false);

        //DbParameterBuilder<R> CreateParameterBuilder();
        //DbParameterBuilder<R> CreateParameterBuilder(int capacity);
        //DbParameterBuilder<R> CreateParameterBuilder(System.Collections.Generic.IEnumerable<R> source);
    }
}
